home *** CD-ROM | disk | FTP | other *** search
- ///////////////////////
- // Example script
- // Harrow Software 96
- //
-
- /////////////////////////////////
- // General Initializers
- //
-
- init_dialog:
- for n = 1 to 10
- listbox "list box" add "selection ",n
- editbox "multiline edit" = "This information has been sent to the edit box by the script"
-
- editbox_handler: element_name, contents
- dialog "single edit" ok "Hello ",$contents
-
- listbox_handler: element_name, selection, select_position
- dialog "list box" ok "You chose ",$selection
-
- draw_3D_graph:
- the_graph = new script "graph3d.sxt"
- the_graph call display_graph
- free the_graph
-
- start_calculator:
- calculator = new script "calc.sxt"
- calculator call init_calculator
-
- start_game:
- the_game = new script "game_1.sxt"
- the_game call start_game
- free the_game
-
- ///////////////////////////////
- // Spaceship controls
- //
-
- space_initialize:
- break mode FALSE
- the_spaceship = new script "starwar.sxt"
- the_spaceship call initialize
-
- space_mouse_move: x, y
- the_spaceship call draw_angle: x, y
-
- space_cleanup:
- free the_spaceship
-
- ///////////////////////////////
- // Hypertext controls
- //
-
- hypertext_init:
- p1 = 0 // record history
-
- hypertext_handler: element_name, topic, hlink, p
- editbox "edit box" = "Page ",p," - ",$topic
- p2 = p1
- p1 = p
-
- hypertext_page:
- display hypertext "sample.fgh" page p
-
- hypertext_search:
- search hypertext "sample.fgh"
-
- ///////////////////////////////////////////////
- // Initialize graph data and color arrays
- //
-
- init_graphs:
-
- // generate an arrays of single and multiple series graph data
-
- my_single_data = new float[10]
- for n = 0 to 9
- my_single_data[n] = rnd 100 // random values 0 to 100
-
- my_multi_data = new float[3][10]
- for n,m = 0,0 to 2,9
- my_multi_data[n][m] = rnd 100 // random values 0 to 100
-
- my_stacked_data = new float[3][10]
- for m = 0 to 9
- total = 0
- for n = 0 to 2
- total = total + my_multi_data[n][m]
- for n = 0 to 2
- my_stacked_data[n][m] = my_multi_data[n][m] / total * 100
-
- // generate pie graph data
-
- my_pie_data = new float[6]
- total = 0
- for n = 0 to 5
- my_pie_data[n] = 10 + rnd 10 // random values 10 to 20
- total = total + my_pie_data[n]
- for n = 0 to 5
- my_pie_data[n] = (my_pie_data[n] / total * 100) ~ 3
- // ~ 3 - only three significant digits
-
- // generate an array of colors
-
- my_colors = new byte[6][3]
- my_colors[0][0] = 0,128,192 // blue
- my_colors[1][0] = 192,96,128 // pink
- my_colors[2][0] = 96,192,96 // green
- my_colors[3][0] = 0,128,192 // blue
- my_colors[4][0] = 192,96,128 // pink
- my_colors[5][0] = 96,192,96 // green
-
- ///////////////////////////
- // return the graph data, colors, min value, max value, and increment
-
- graph_handler_1: element_name
- return @my_single_data, @my_colors, 0, 100, 10
-
- graph_handler_2: element_name
- return @my_multi_data, @my_colors, 0, 100, 10
-
- graph_handler_3: element_name
- return @my_stacked_data, @my_colors, 0, 100, 10
-
- graph_handler_4: element_name
- return @my_pie_data, @my_colors, 0, 100, 10
-
- ///////////////////////////
- enable_handler:
- enable all mode enable_flag
- if !enable_flag
- enable element "enable" mode TRUE
-
- set_focus:
- set focus "single edit"
-
- next_focus:
- next focus
-
-